import {useUserStore} from '@/stores/userStore.js'

export function useDirc(app) {
    /* 当前用户的所有权限
     * @type {string[]}
     */


    app.directive('hasPerms', (el, binding) => {


        const userStore = useUserStore();
        const queryPermisssion = userStore.getUnfoldPermission


        const validatePerms = binding.value;
        if (queryPermisssion.indexOf(validatePerms) != -1) {
            // 这会在 `mounted` 和 `updated` 时都调用
            el.style.display = "block"
        } else {
            el.style.display = "none"
        }

    })
}